var mongoose = require('mongoose');
mongoose.Promise = global.Promise;
var DB_URL = 'mongodb://localhost:27017/my_database';
 mongoose.connect(DB_URL);

mongoose.connection.on('error',console.error.bind(console,'连接错误:'));
mongoose.connection.once('connected',function(){
   console.log("connected mongoodb!");
});
mongoose.connection.on('disconnected', function () {
    console.log('Mongoose connection disconnected');
});
module.exports = mongoose;
